﻿using HCQ2_IBLL;
using HCQ2_Model.VLine.InputDto._0416;
using HCQ2_Model.VLine.InputDto._20220219;
using HCQ2_Model.VLine.OutputDto._20220219;
using HCQ2_Model.VLine.Params;
using HCQ2_Model.VLine.Result;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace HCQ2_BLL
{
    public partial class T_VRDDKeywordBLL: IT_VRDDKeywordBLL
    {
        /// <summary>
        ///  获取好友申请列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List<SKeywordResult> GetKeywordList(KeywordParam param, out int total)
        {
            return DBSession.IT_VRDDKeywordDAL.GetKeywordList(param, out total);
        }
        //***************************2.0 消息推送*******************************
        /// <summary>
        ///  获取推送消息列表
        /// </summary>
        /// <param name="messType">消息类别</param>
        /// <param name="keyword">关键字</param>
        /// <param name="total">返回条数</param>
        /// <returns></returns>
        public List<MessListResult> GetMessTableList(MessTableParam param, out int total)
        {
            return DBSession.IT_VRDDKeywordDAL.GetMessTableList(param, out total);
        }
        /// <summary>
        ///  获取推送用用户列表
        /// </summary>
        /// <param name="messType">消息类别</param>
        /// <param name="messNote">消息内容</param>
        /// <param name="keyword">接收人、手机号</param>
        /// <param name="messId">消息id</param>
        /// <param name="total">返回条数</param>
        /// <returns></returns>
        public List<MessUserListResult> GetMessUserTableList(MessUserTableParam param, out int total)
        {
            return DBSession.IT_VRDDKeywordDAL.GetMessUserTableList(param, out total);
        }

        //*************************** 接口消息推送*******************************
        /// <summary>
        ///  获取推送消息列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List<PushMsgOutput> GetPushMsgList(InputPushMsgParam param, int user_id)
        {
            var list= DBSession.IT_VRDDKeywordDAL.GetPushMsgList(param, user_id);
            list?.ForEach(s =>
            {
                if (!string.IsNullOrEmpty(s.storeImage))
                    s.storeImage = s.storeImage.Replace("~", HttpContext.Current.Request.Url.AbsoluteUri.Substring(0, HttpContext.Current.Request.Url.AbsoluteUri.IndexOf("/api/")));
            });
            return list;
        }
        /// <summary>
        ///  获取店铺推送消息
        /// </summary>
        /// <param name="param"></param>
        /// <param name="user_id"></param>
        /// <returns></returns>
        public List<StorePushOutput> GetStorePushMsg(StorePushInput param, int user_id)
        {
            var list = DBSession.IT_VRDDKeywordDAL.GetStorePushMsg(param, user_id);
            list?.ForEach(s =>
            {
                if (!string.IsNullOrEmpty(s.storeImage))
                    s.storeImage = s.storeImage.Replace("~", HttpContext.Current.Request.Url.AbsoluteUri.Substring(0, HttpContext.Current.Request.Url.AbsoluteUri.IndexOf("/api/")));
            });
            return list;
        }
    }
}